package com.saer.server.hibernate.model;

// Generated 02/10/2012 01:48:05 by Hibernate Tools 3.4.0.CR1

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Cap generated by hbm2java
 */
@Entity
@Table(name = "cap", catalog = "saer")
public class Cap implements java.io.Serializable {

	private static final long serialVersionUID = -1762197442962072554L;
	private int id;
	private Hospital hospital;

	private String descripcion;

	private Set<Visita> visitas = new HashSet<Visita>(0);

	public Cap() {
	}

	public Cap(int id) {
		this.id = id;
	}

	public Cap(int id, String descripcion, Set<Visita> visitas,
			Hospital hospital) {
		this.id = id;
		this.descripcion = descripcion;
		this.visitas = visitas;
		this.hospital = hospital;
	}

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}

	@Column(name = "descripcion", nullable = false, length = 200)
	public String getDescripcion() {
		return this.descripcion;
	}

	public void setDescripcion(String descripcion) {
		this.descripcion = descripcion;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "cap")
	public Set<Visita> getVisitas() {
		return this.visitas;
	}

	public void setVisitas(Set<Visita> visitas) {
		this.visitas = visitas;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "hospital_id", nullable = false)
	public Hospital getHospital() {
		return this.hospital;
	}

	public void setHospital(Hospital hospital) {
		this.hospital = hospital;
	}

}
